package com.zmm.zebulon.module.system.biz.api.mail;

import com.zmm.zebulon.module.system.api.mail.MailSendApi;
import com.zmm.zebulon.module.system.api.mail.dto.MailSendSingleToUserReqDTO;
import com.zmm.zebulon.module.system.biz.service.mail.MailSendService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

/**
 * description: 邮件发送 API 实现类
 *
 * @author zebulon
 * package com.zmm.zebulon.module.system.biz.api.mail
 * name: MailSendApiImpl
 * date 2024/1/7 22:07
 */
@Service
@Validated
public class MailSendApiImpl implements MailSendApi {

    @Resource
    private MailSendService mailSendService;

    @Override
    public Long sendSingleMailToAdmin(MailSendSingleToUserReqDTO reqDTO) {
        return mailSendService.sendSingleMailToAdmin(reqDTO.getMail(), reqDTO.getUserId(),
                reqDTO.getTemplateCode(), reqDTO.getTemplateParams());
    }

    @Override
    public Long sendSingleMailToMember(MailSendSingleToUserReqDTO reqDTO) {
        return mailSendService.sendSingleMailToMember(reqDTO.getMail(), reqDTO.getUserId(),
                reqDTO.getTemplateCode(), reqDTO.getTemplateParams());
    }

}
